<!DOCTYPE html>
<html lang="{{ current_language }}">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ tool.name }} - {{ app_title }}</title>
    <link rel="stylesheet" href="/static/css/light-theme.css">
    <link rel="stylesheet" href="/static/css/dark-theme.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <link rel="icon" href="/static/favicon.ico">
    <!-- 通用样式已移至common.css -->
    <link rel="stylesheet" href="/static/css/common.css">
    <link rel="stylesheet" href="/static/css/language-switcher.css">
    <!-- 引入Bootstrap或其他UI框架 -->
    <link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 引入Feather图标 -->
    <script src="/node_modules/feather-icons/dist/feather.min.js"></script>
    <!-- 引入主题切换脚本 -->
    <script src="/static/js/theme.js"></script>
    <!-- 引入语言切换脚本 -->
    <script src="/static/js/language.js"></script>
    {% block extra_head %}{% endblock %}
</head>
<body data-theme="default" class="dark">
    <header class="bg-primary text-white p-3">
        <div class="container">
            <div class="d-flex justify-content-between align-items-center">
                <h1><a href="/" class="text-white text-decoration-none">LiberTool</a></h1>
                <div class="d-flex align-items-center">
                    <!-- 语言切换下拉菜单 -->
                    <div class="dropdown me-3">
                        <button class="btn btn-sm btn-outline-light dropdown-toggle" type="button" id="languageDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                            <i data-feather="globe" class="me-1"></i>
                            {% for lang in supported_languages %}
                                {% if lang.code == current_language %}
                                    {{ lang.name }}
                                {% endif %}
                            {% endfor %}
                        </button>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="languageDropdown">
                            {% for lang in supported_languages %}
                                <li><a class="dropdown-item {% if lang.code == current_language %}active{% endif %}" href="/set-language/{{ lang.code }}">{{ lang.name }}</a></li>
                            {% endfor %}
                        </ul>
                    </div>
                    <!-- 主题切换开关 -->
                    <div class="d-flex align-items-center me-3">
                        <i data-feather="sun" class="text-white"></i>
                        <label class="theme-switch mx-2">
                            <input type="checkbox" id="theme-toggle" onchange="toggleTheme()">
                            <span class="slider"></span>
                        </label>
                        <i data-feather="moon" class="text-white"></i>
                    </div>
                    <a href="/" class="btn btn-outline-light">{{ back_to_home }}</a>
                </div>
            </div>
        </div>
    </header>

    <main class="container my-4">
        <div class="d-flex align-items-center mb-4">
            <h2 class="mb-0 me-3">{{ tool.name }}</h2>
            <button class="btn btn-primary btn-sm" onclick="window.history.go(-1); return false;">
                <img src="https://liberc.oss-cn-shanghai.aliyuncs.com/mooe_img/2025%2F04%2F9a76b3fb94115c83bb712290f97fdb93.svg" class="me-1 btn-back-icon">返回
            </button>
          </div>
        
        {% block content %}{% endblock %}
    </main>

    <footer class="bg-light py-3 mt-5">
        <div class="container text-center">
            <p class="mb-0">{{ copyright }}</p>
        </div>
    </footer>

    <!-- 引入Bootstrap JS -->
    <script src="/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 初始化Feather图标
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
        });
    </script>
    {% block scripts %}{% endblock %}
</body>
</html>